#include <iostream>
using namespace std;
#pragma pack(2)
// g++ -o test_sizeof test_sizeof.cc -std=c++11
class A {};
class B {
  int a;
  char b;
  void func() {}
};
class C : virtual B {  // 虚继承
  double a;
};
class D : B {
  double a;
};
class E {
  virtual void func1() {}
  virtual void func2() {}
  char a;
  int b;
};
class F {
  virtual void func1() {}
  virtual void func2() {}
  char b;
};
class G : E, F {  // 多继承，默认继承方式为private
  int a;
  virtual void func3();
};
void test_class() {
  cout << "sizeof(A)= " << sizeof(A) << endl;
  cout << "sizeof(B)= " << sizeof(B) << endl;
  cout << "sizeof(C)= " << sizeof(C) << endl;
  cout << "sizeof(D)= " << sizeof(D) << endl;
  cout << "sizeof(E)= " << sizeof(E) << endl;
  cout << "sizeof(F)= " << sizeof(F) << endl;
  cout << "sizeof(G)= " << sizeof(G) << endl;
}
int main() {
  test_class();
  return 0;
}
/*
sizeof(A)= 1
sizeof(B)= 8
sizeof(C)= 24
sizeof(D)= 16
sizeof(E)= 16
sizeof(F)= 16
sizeof(G)= 32
*/